export default {
  install(Vue) {
    Vue.mixin({
      data() {
        return {
          //1维保单位  2巡检员
          tabbarArrayType: null,
          tabbarArray: [],
        };
      },
      created() {
        this.getCurrentType();
        /* this.permission() */
      },
      methods: {
        //登录之后 获取 身份
        getCurrentType() {
			let pages = getCurrentPages();
			let prevPage = pages[pages.length - 1];
          //身份信息
          this.tabbarArrayType = uni.getStorageSync("tabbarArrayType");
          //tabbar 数组信息
          this.tabbarArray = uni.getStorageSync("tabbarArray");
          if (!this.tabbarArray || !this.tabbarArrayType) {
            if (prevPage.route != "pages/login/login") {
              uni.showToast({
                title: "身份信息失效，请重新登录",
                icon: "none",
                duration: 1500,
              });
              setTimeout(function () {
                uni.reLaunch({
                  url: "/pages/login/login",
                });
              }, 1500);
            } else {
            }
          } else {
            console.log("有身份信息");
          }
        },
        permission() {
          let pages = getCurrentPages();
          let prevPage = pages[pages.length - 1];
          /* console.log(prevPage,1998); */
        },
      },
    });
  },
};
